<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="js/AjaxScript.js"></script>
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<title>Insert title here</title>
<!-- <script type="text/javascript">
	$(document).ready(function() {
		$(function() {
			$('#username').blur(function() {
				//alert("hrhr");
				$.ajax({
					type : "POST",
					url : "AjaxServlet",
					data : {
						username : $("#username").val()
					},
					dataType : "XML",
					success : function(xml) {
						alert($('text',xml).text());
					}
				});
			});
		});
	});
</script> -->
<!-- <script type="text/javascript">
	$(document).ready(function() {
		$(function() {
			$("#username").blur(function() {
				//alert("hrhr");
				$.ajax({
					type : "GET",
					url : "AjaxServlet",
					data : {
						username : $("#username").val()
					},
					dataType : "json",
					success : function(json) {
						$.each(json,function(index,temp){
							//$('#text1').innerHTML = temp['result']+temp['errCode'];
							alert(temp.result+temp.errCode);
							$("#text1").html(temp.result+temp.errCode);
						});
					}
				});
			});
		});
	});
</script> -->
<script type="text/javascript">
	$(document).ready(function() {
		$(function() {
			$("#username").blur(function() {
				//alert("hrhr");
				$.ajax({
					type : "GET",
					url : "AjaxServlet",
					data : {
						username : $("#username").val()
					},
					dataType : "json",
					success : function(json) {
						alert(json.result+json.errCode);
						$("#text1").html(json.result+json.errCode);
/* 						$.each(json,function(index,temp){
							//$('#text1').innerHTML = temp['result']+temp['errCode'];
							alert(temp.result+temp.errCode);
							$("#text1").html(temp.result+temp.errCode);
						}); */
					}
				});
			});
		});
	});
</script>
</head>
<body>
	<div>
		<div>
			<span>用户名：</span>
		</div>
		<div>
			<input type="text" name="username" id="username"> <span id="text1"></span>
		</div>
	</div>
	<div>
		<div>
			<span>密 码：</span>
		</div>
		<div>
			<input type="text" name="password" id="password"> <span id="text2"></span>
		</div>
	</div>
	<div><input type="button" id="button1" value="点击它"></div>
</body>
</html>